﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace BCSALE
{
    public partial class frmMain : DevComponents.DotNetBar.Office2007RibbonForm
    {
        public frmMain()
        {            
            InitializeComponent();
        }

        //Hiển thị tab bán hàng, thu tiền
        private void btnBanHangThuTien_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiBanHangThuTien;            
        }

        //Hiển thị tab quản lý hàng hóa
        private void btnQuanLyHangHoa_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiQuanLyHangHoa;
        }

        //Hiển thị tab báo cáo
        private void btnBaoCao_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiBaoCao;
        }

        //Hiển thị tab người dùng
        private void btnQLNguoiDung_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiQLNguoiDung;
        }

        //Hiển thị tab thiết lập
        private void btnThietLap_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiThietLap;
        }

        //Chuyển sang tab chức năng -> Chọn tab bán hàng
        private void rtiChucNang_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiBanHangThuTien;
        }

        //Highlight button khi selected tab thay đổi
        private void stcMain_SelectedTabChanging(object sender, SuperTabStripSelectedTabChangingEventArgs e)
        {
            string tenButtonCu = e.OldValue.Name.Replace("sti","btn");
            string tenButtonMoi = e.NewValue.Name.Replace("sti", "btn");
            
            if (tenButtonCu == tenButtonMoi)
                return;

            ButtonItem btnCu = layButtonItem(tenButtonCu);
            ButtonItem btnMoi = layButtonItem(tenButtonMoi);

            if (btnCu != null)
            {                
                btnCu.ColorTable = eButtonColor.Orange;
            }
            if (btnMoi != null)
            {                
                btnMoi.ColorTable = eButtonColor.OrangeWithBackground;
            }            
        }

        //Lấy button để highlight
        private ButtonItem layButtonItem(string ten)
        {            
            switch (ten)
            {
                case "btnBanHangThuTien":                    
                    return btnBanHangThuTien;                    
                case "btnBaoCao":
                    return btnBaoCao;                                         
                case "btnQuanLyHangHoa":
                    return btnQuanLyHangHoa;                    
                case "btnThietLap":
                    return btnThietLap;                            
                default:
                    return null;
            }
        }

        //Chuyển qua tab quản lý người dùng
        private void rtiQLNguoiDung_Click(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiQLNguoiDung;
        }

        //Khi mở form, hiện tab chương trình
        private void frmMain_Load(object sender, EventArgs e)
        {
            stcMain.SelectedTab = stiChuongTrinh;
        }

        private void rbcMain_Click(object sender, EventArgs e)
        {

        }

        private void btnThemNguoiDung_Click(object sender, EventArgs e)
        {

        }

        private void btnHoaDonBanHang_Click(object sender, EventArgs e)
        {

        }

        private void btnDonMuaHang_Click(object sender, EventArgs e)
        {

        }

        private void btnDonTraHangNCC_Click(object sender, EventArgs e)
        {

        }

        private void btnHoaDonKhachTraHang_Click(object sender, EventArgs e)
        {

        }

        private void btnPhieuThu_Click(object sender, EventArgs e)
        {

        }

        private void btnPhieuChi_Click(object sender, EventArgs e)
        {

        }

        private void btnSanPhamBanChay_Click(object sender, EventArgs e)
        {

        }

        private void btnDoanhThu_Click(object sender, EventArgs e)
        {

        }

        private void btnTonKho_Click(object sender, EventArgs e)
        {

        }

        private void superTabControlPanel6_Click(object sender, EventArgs e)
        {

        }

        private void office2007StartButton1_Click(object sender, EventArgs e)
        {
                    }

        private void btnBanSi_Click(object sender, EventArgs e)
        {
            frmBanHang frm = new frmBanHang(BanHang.BAN_SI);
            frm.ShowDialog();
        }

        private void btnMaTuDong_Click(object sender, EventArgs e)
        {
            frmMaTuDong frm = new frmMaTuDong();
            frm.ShowDialog();
        }

        private void btnDanhMucHangHoa_Click(object sender, EventArgs e)
        {
            frmDanhMucHangHoa frm = new frmDanhMucHangHoa();
            frm.ShowDialog();
        }
    }
}